<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="../css/H-ui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../js/jqueryPagination/jquery.pagination.css"/>
    <title>酒钱提现管理</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页 <span class="c-gray en">&gt;</span>
    酒钱提现审核 <span class="c-gray en">&gt;</span>
    酒钱提现列表
</nav>
<div class="page-container statusFlowVoList">
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="r">共有数据：<strong class="total"></strong> 条</span>
        <input type="hidden" id="withdrawId" dataId="" />
        <input type="hidden" id="custName" dataName=""/>
        <input type="hidden" id="pageNum" data="data-pageNum"/>
    </div>
    <div>
        <div class="condition-row clearfix pd-5">
            <div class="fl paLeft">
                <input type="text" name="name" id="name" placeholder="请输入客户姓名" class="input-text"
                       onblur="replaceSpace(this.value,this.id)">
            </div>
            <div class="fl paLeft">
                <select name="status" id="status" style="width: 100px;">
                    <option value="">提现状态</option>
                    <option value="-1">提现失败</option>
                    <option value="0">提现待完成</option>
                    <option value="1">提现成功</option>
                </select>
            </div>
            <div class="fl paLeft">
                <select name="paymentChannel" id="paymentChannel" style="width: 100px;">
                    <option value="">支付通道</option>
                    <option value="1">微信</option>
                    <option value="2">支付宝</option>
                    <option value="3">银行卡</option>
                </select>
            </div>
            <div class="btn btn-success radius searchBtn" onclick="getData(0)">搜索</div>
        </div>
    </div>
    <table class="table table-border table-bordered table-hover table-bg table-sort ">
        <thead>
        <tr>
            <th scope="col" colspan="17">客户酒钱列表</th>
        </tr>
        <tr class="text-c">
            <th>流水ID</th>
            <th>提现前酒钱</th>
            <th>提现后酒钱</th>
            <th>申请提现金额</th>
            <th>微信号</th>
            <th>账户姓名</th>
            <th>银行卡号</th>
            <th>提现时间</th>
            <th>提现状态</th>
<!--            <th>实际支付金额</th>-->
<!--            <th>支付备注说明</th>-->
            <th>审核时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody class="tableCon">

        </tbody>
    </table>
    <div id="PaginationListTop1" class="page">
        <div id="PaginationList1" class="page-wrap" style="">
            <div id="Pagination2"></div>
        </div>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="../js/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../js/H-ui.js"></script>
<script type="text/javascript" src="../js/H-ui.min.js"></script>
<script type="text/javascript" src="../js/postJson.js"></script>
<script type="text/javascript" src="../js/jqueryPagination/jquery.pagination.min.js"></script>
<script type="text/javascript" src="../js/cerTypeState.js"></script>
<script type="text/javascript" src="/js/root.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

    function getData(pageNo) {
        var pageNum = pageNo == 0 ? 1 : pageNo;
        var pageSize = 10;
        var name = $("#name").val();
        var status = $("#status").find("option:selected").val();
        var paymentChannel = $("#paymentChannel").find("option:selected").val();
        var jsonObj = {
            "name": name,
            "paymentChannel": paymentChannel,
            "status": status,
            "pageNo": pageNum,
            "pageSize": pageSize
        }
        var jsonData = JSON.stringify(jsonObj)
        var url =  "/commissionBalanceController/getCommissionWithdrawFlowVoList";
        $.ajax({
            url: url,
            contentType: "application/json",
            data: jsonData,
            type: "post",
            async: false,
            dataType: 'json',
            success: function (msg) {
                // console.log(JSON.stringify(msg))
                $(".tableCon ").empty();
                var htmlString = '';
                $(".total").text(msg.data.total)
                if (msg.data.list != null) {
                    $.each(msg.data.list, function (i, n) {
                        htmlString += '<tr class="text-c">'
                        htmlString += '<td>' + ifNull(n.id) + '</td>'
                        htmlString += '<td>' + ifNull(n.balancePre) + '</td>'
                        htmlString += '<td>' + ifNull(n.balanceAfter) + '</td>'
                        htmlString += '<td style="color: red">' + ifNull(n.withdrawAmount) + '</td>'
                        htmlString += '<td>' + ifNull(n.wxAccountNo) + '</td>'
                        htmlString += '<td>' + ifNull(n.accountName) + '</td>'
                        htmlString += '<td>' + ifNull(n.accountNo) + '</td>'
                        htmlString += '<td>' + TimeHours(n.createTime) + '</td>'

                        htmlString += '<td>' + withdrawFlowStatus(n.status) + '</td>'
                        htmlString += '<td>' + TimeHours(n.payTime) + '</td>'
                        // htmlString += '<td>' + ifNull(n.payAmount) + '</td>'
                        //
                        // htmlString += '<td>' + ifNull(n.payRemark) + '</td>'
                        // htmlString += '<td>' + ifNull(n.wxPayNo) + '</td>'
                        htmlString += '<td class="text-c">'
                        if(n.status == 0){
                            htmlString += '<a class="btn btn-danger radius m_lr10" onclick="toCommissionWithdrawDetail(' + "\'确认提现\'" + ',' + "\'toCommissionWithdrawDetail\'" + ',' + n.id + ','+"\'"+ n.name+"\'"+',' + 800 + ',' + 550 + ','+msg.data.pageNum+')">确认提现</a>'
                        }
                        htmlString += '</td>'
                        htmlString += '</tr>'
                    })
                } else {
                    htmlString += '<tr class="text-c"><td colspan="9">没有找到匹配的记录</td></tr>'
                }
                $(".tableCon ").append(htmlString);

                var newPageNo = pageNo == 0 ? 1 : pageNo
                //翻页
                $("#Pagination2").pagination({
                    currentPage: newPageNo,
                    totalData: msg.data.total,
                    totalPage: msg.data.pages,
                    isShow: true,
                    count: 4,
                    showData: pageSize,
                    homePageText: "首页",
                    endPageText: "尾页",
                    prevPageText: "上一页",
                    nextPageText: "下一页",
                    callback: getData
                });
                $("input[placeholder='页码']").css({
                    "border": "solid 1px #c5b7b7"
                })
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                var XmlStatus = XMLHttpRequest.status
                if (XmlStatus == 401) {
                    alert(XmlError.error401)
                    parent.window.location.href = "login"
                }
                if (XmlStatus == 403) {
                    alert(XmlError.error403)
                }
            }
        });
    }
    getData(0)


    //云酒钱流水状态
    function withdrawFlowStatus(data) {
        if (data == -1) {
            return '提现失败'
        } else if (data == 0) {
            return '提现待完成'
        } else if (data == 1) {
            return '提现成功'
        }else{
            "-"
        }
    }
    //支付通道状态
    function withdrawPaymentChannel(data) {
        if(data == null){
            return '-'
        }
        if (data == 1) {
            return '微信'
        } else if (data == 2) {
            return '支付宝'
        } else if (data == 3) {
            return '银行卡'
        }
    }
    /*基本信息*/
    function toCommissionWithdrawDetail(title, url, id, name,w, h,pageNum) {
        $("#withdrawId").attr("dataId", id);
        $("#custName").attr({"dataName": name, "data-pageNum": pageNum});
        layer_show(title, url, w, h);
    }


    //键盘按下Enter键搜索
    $(document).keyup(function (e) {
        if (e.keyCode == 13) {
            $(".searchBtn").click()
        }
    })

</script>
</body>
</html>